<?php
/*
 * 进云智能生成平台
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
 */

defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$return['setting']=$this->plugin_setting('basic');
$uniacid=$_SESSION['uniacid'];
if($_RQ['op']=='main'){
	//查询所有
	//$list=pdo_getall('jy_smallquan_device',array('uniacid'=>$uniacid,'status'=>1));
	//$return['list']=$list;
	$return['params']=array('keyword'=>'');
	$return['post']=array('id'=>$_RQ['dc_id']);
	
	exi($return);
}
if($_RQ['op']=='getlist'){
	if(!empty($_RQ['keyword'])){
		$params['title like']='%'.trim($_RQ['keyword']).'%';
		$return['params']['keyword']=$_RQ['keyword'];
	}
	$params['status']=1;
	$params['uniacid']=$uniacid;
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$fields=array('id','uniacid','title','status','image','mid','content','createtime');
	$list=pdo_getslice('jy_smallquan_advise',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$member=pdo_get('core_members',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['mid']));
			$item['member']=$member;
			$item['name']=pdo_getcolumn('jy_smallquan_household',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['mid']),'name');
			$item['createtime']=date('y-m-d h:i',$item['createtime']);
		}
	}
	$return['list']=$list;
	exi($return);
	
}

		
		


